<template>
	<view>
		<view id="pdf"></view>
	</view>
</template>

<script>
	import Pdfh5 from "pdfh5";

	export default {
		name: "pdf",
		props: {
			url: String
		},
		data() {
			return {
				pdfH5: null
			};
		},
		mounted() {
			this.$nextTick(() => {
				this.showPdfFile(this.url);
			});
		},
		methods: {
			showPdfFile(file_url) {
				this.pdfH5 = new Pdfh5("#pdf", {
					pdfurl: file_url
				});
				//监听完成事件
				this.pdfH5.on("complete", function(status, msg, time) {
					console.log("状态：" + status + "，信息：" + msg + "，耗时：" + time + "毫秒，总页数：")
				});
			},
		}
	}
</script>

<style scoped>
	#pdf {
		width: 100vw;
		height: 100vh;
		overflow-y: auto;
	}
</style>
